package com.neusoft.acquistion.sensor.consumer.service.impl;

import com.neusoft.acquistion.sensor.consumer.entity.Patient;
import com.neusoft.acquistion.sensor.consumer.mapper.PatientMapper;
import com.neusoft.acquistion.sensor.consumer.service.IPatientService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.HashMap;

/**
 * <p>
 * 病例信息表 服务实现类
 * </p>
 *
 * @author 段静迪
 * @since 2024-04-26 14:10:56
 */
@Service
public class PatientServiceImpl extends ServiceImpl<PatientMapper, Patient> implements IPatientService {

    private  static  final HashMap<String,String> patientsMap = new HashMap<>() ;

    @Override
    public String findPatientIdById(String medicalcode) {
        String personId = patientsMap.get(medicalcode);
        if (personId == null)
        {
            Patient patient  = this.getById(medicalcode);
            patientsMap.put(medicalcode,patient.getPersonId());
            personId =   patient.getPersonId() ;
        };
        return personId;
    }



}
